package com.gnrsoft.springcloud.service.ribbon;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@EnableHystrix    //开启断路器 加入 <artifactId>spring-cloud-starter-hystrix</artifactId> 依赖
@EnableHystrixDashboard   //开启断路器：Hystrix 仪表盘  <artifactId>spring-boot-starter-actuator</artifactId>  <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
//Hystrix Dashboard 地址 http://localhost:8764/hystrix   监控地址 http://localhost:8764/hystrix.stream
public class ServiceRibbonApplication {

	public static void main(String[] args) {
		SpringApplication.run(ServiceRibbonApplication.class, args);
	}

	@Bean
	@LoadBalanced
	RestTemplate restTemplate() {
		return new RestTemplate();
	}
	
}
